using Lucene.Net.Search;

namespace NopSolutions.NopCommerce.LuceneHelper.Queries
{
    public class CategoryQuery : BaseQuery<CategoryQuery>
    {

        public CategoryQuery(Query query)
            :base(query)
        {
        }
        public CategoryQuery()
        {
        }

        public CategoryQuery WithParent(int categoryId)
        {
            this.Query = JoinQueries(this.Query, TermQuery("ParentID", categoryId.ToString()));
            return this;
        }
        public CategoryQuery HasChildren(bool value)
        {
            this.Query = JoinQueries(this.Query, TermQuery("HasChildren", value.ToString()));
            return this;
        }

        public override LuceneIndexType IndexType
        {
            get { return LuceneIndexType.Category; }
        }
    }
}
